function szmpwin() {
  var odrag = document.getElementById("szmpwin");
  odrag.onmousedown = function (ev) {
      document.onselectstart = function(e) { return false } // 鼠标按下时，禁用选择内容
      var oevent = ev || event;
      var distanceX = oevent.clientX - odrag.offsetLeft;
      var distanceY = oevent.clientY - odrag.offsetTop;
      var old_x=oevent.clientX;
      var old_y=oevent.clientY;
      document.onmousemove = function (ev) {
          var oevent = ev || event;
          var _x, _y;
          _x = oevent.clientX - distanceX;
          _y = oevent.clientY - distanceY;
          if (_x < 0) _x = 0;
          if (_y < 0) _y = 0;
          if (_x > document.body.clientWidth - odrag.offsetWidth) _x = document.body.clientWidth  - odrag.offsetWidth;
          if (_y > document.body.clientHeight  - odrag.offsetHeight) _y = document.body.clientHeight  - odrag.offsetHeight;
          odrag.style.left = _x + 'px';
          odrag.style.top = _y + 'px';
      };
      document.onmouseup = function (ev) {
          document.onselectstart = function(e) { return true } // 启用选择
          var oevent = ev || event;
          var _x = oevent.clientX - distanceX;
          var _y = oevent.clientY - distanceY;

          // var leftindex=(_x/$("body").width()).toFixed(2);
          // var topindex=(_y/$("body").height()).toFixed(2);
          //存储位置区域比列或者具体数据
          document.onmousemove = null;
          document.onmouseup = null;
      };
  }
  $('#szmpwin>i').on('click',function(e){
    //打开窗口
    layer.open({
        id: 'szoampinpc',
        type: 2,
        title: '盛筑OA-手机端',
        content: '/mp/',
        area: ['375px', '667px'],
        offset: 'rb',
        anim: 2,
        shade: 0,
        maxmin: false,
        moveOut: false,  //允许拖出窗外
        //销毁回调
        end: function () { },
        //拖动回调
        moveEnd: function (layero) { },
        //打开回调
        success: function (layero, index) {
            $('#szmpwin').hide();
        },
        //关闭回调
        cancel: function (index, layero) {
            $('#szmpwin').show();
         }
    });
  });
}
